package com.ydjk.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ydjk.common.utils.DateUtils;
import com.ydjk.common.utils.StringUtils;
import com.ydjk.common.utils.pageData.PageData;
import com.ydjk.domain.JkHospitalizationInfo;
import com.ydjk.domain.JkUser;
import com.ydjk.mapper.JkHospitalizationInfoMapper;
import com.ydjk.mapper.JkHospitalizationMapper;
import com.ydjk.mapper.JkUserMapper;
import com.ydjk.service.IJkHospitalizationService;
import com.ydjk.service.IJkUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 用户信息Service业务层处理
 *
 * @author ydjk
 * @date 2023-08-30
 */
@Service
public class JkHospitalizationServiceImpl implements IJkHospitalizationService
{
    @Autowired
    private JkHospitalizationMapper jkHospitalizationMapper;
    @Autowired
    private JkHospitalizationInfoMapper jkHospitalizationInfoMapper;



    @Override
    public List<PageData> selectHospitalization(PageData pageData)
    {
        return ( List<PageData> )jkHospitalizationInfoMapper.selectHospitalization(pageData);
    }

    @Override
    public int updateHospitalization(PageData pageData) {

        /*if(StringUtils.isNotNull(pageData.get("admissionTime")) && StringUtils.isNotEmpty(pageData.get("admissionTime")+"")  ){
            pageData.put("admissionTime",DateUtils.getDate() );
        }
        if(StringUtils.isNotNull(pageData.get("dischargeTime"))  && StringUtils.isNotEmpty(pageData.get("dischargeTime")+"") ){
            pageData.put("dischargeTime", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,pageData.get("dischargeTime")));
        }
        if(StringUtils.isNotNull(pageData.get("operationTime"))  && StringUtils.isNotEmpty(pageData.get("operationTime")+"")){
            pageData.put("operationTime", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,pageData.get("operationTime")+""));
        }*/
        jkHospitalizationInfoMapper.admissionUpdate(pageData);
        return 1;
    }

    @Override
    public int updateJkHospitalizationInfo(JkHospitalizationInfo jkHospitalizationInfo) {
        return jkHospitalizationInfoMapper.updateJkHospitalizationInfo(jkHospitalizationInfo);
    }


}
